<template>
  <div>
    <textarea
      :id="ID"
      v-model="content"
    ></textarea>
  </div>
</template>

<script>
export default {
  props: {
    content: {
      type: String,
      default: '',
    },
    config: {
      type: Object,
      default() {
        return this.$global.TinymceSetting
      },
    },
  },
  data() {
    return {
      ID: Date.now(),
      Editor: (1)._,
      DefaultConfig: {},
    }
  },
  mounted() {
    this.init()
  },
  methods: {
    init() {
      this.Editor = this.$tinymce.init({
        ...this.DefaultConfig,
        ...this.config,
        selector: `#${this.ID}`,
        setup: (editor) => {
          // console.log(editor)
          editor.setContent(this.value)
        },
      })
    },
    getContent() {
      console.log(this.Editor)
    }
  },
}
</script>

<style>
</style>